*Figure 1

 cd "/Users/kevin/Dropbox/TZ ITNs"

set more off
set varabbrev off

use "constructed data/for_analysis.dta", clear

cd "/Users/kevin/Dropbox/TZ ITNs/plots"

 *Figure 1
 foreach y in $bednet2 {  
bys time_since_ucc: egen mean_`y'_2010=mean(`y')
twoway (lpoly `y' time_since_ucc if time_since_ucc<-15 & sample==1, lcolor(black) clwidth(thick)) (lpoly `y' time_since_ucc if time_since_ucc>15 & sample==1, ///
lcolor(black) clwidth(thick)) ///
(scatter mean_`y'_2010 time_since_ucc, msize(vsmall) color(gray)) if (time_since_ucc<-15 | time_since_ucc>15) & sample==1, ///
title(`variable label `y'', color(black)) xline(-15 15, lpattern(dash) lcolor(black)) legend(off) ylabel(, nogrid) xtitle(days since ITN distribution, size(medlarge)) yscale(r(0 1))  ///
ytitle(`: variable label `y'', size(medlarge)) ///
subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) xlabel(-365(100)365) xline(-90 90, lpattern(dash) lcolor(gs12))
graph save Graph "`y'.gph", replace
}  
  graph combine "anyslept_itn.gph" "itn_pct.gph" "free_itn_all.gph" "free_hh_all.gph", ///
  rows(2) cols(2) subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))
